# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgbase=ConsoleKit2
pkgname=consolekit2
pkgver=1.2.1
pkgrel=1
pkgdesc="A framework for defining and tracking users, login sessions, and seats"
provides="consolekit=$pkgver"
replaces=consolekit
arch=all
url="https://consolekit2.github.io/ConsoleKit2"
license=GPL2
depends="polkit eudev"
makedepends="git automake autoconf gettext-dev glib-dev zlib-dev libxslt-dev
	polkit-dev eudev-dev libdrm-dev libnih-dev libtool xorg-server-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/${pkgname}/${pkgname}/archive/${pkgver}.tar.gz
		0001-busybox-reboot-and-poweroff-support.patch
		pam-foreground-compat.ck"
subpackages="$pkgname-dev $pkgname-doc $pkgname-lang"
builddir="$srcdir"/$pkgbase-$pkgver
options="!check" #no testsuite provided

prepare() {
	default_prepare
	NOCONFIGURE=1 ./autogen.sh
}

build() {
	cd "$builddir"
	./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var \
		--disable-static
	sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
	make
}

package() {
	cd "$builddir"
	make DESTDIR="$pkgdir" install
	install -m 755 "$srcdir"/pam-foreground-compat.ck \
		"$pkgdir"/usr/lib/ConsoleKit/run-session.d/
}
sha512sums="b62a43b2748b9302b86847a3c4c84f931d7df9fef028dffbad091dd7b176c57109adec65e49f9f8a3c5e5e03a5d9b29f8b96e3328f9b9bfb32fd767fceecde81  consolekit2-1.2.1.tar.gz
ec0c88e640afac0561c84131d63fa8c9e2e29611b789ae5c163cd11465b22017602d88dc853866624f57bce2ee466ab63af075d083a9ba6e87327ad8d0a0769f  0001-busybox-reboot-and-poweroff-support.patch
3b114fbbe74cfba0bfd4dad0eb1b85d08b4979a998980c1cbcd7f44b8a16b0ceca224680d4f4a1644cd24698f8817e5e8bdfcdc4ead87a122d0e323142f47910  pam-foreground-compat.ck"
